home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / Incognito / init / Patch.a < prev    next >
Encoding:
Text File  |  1993-12-27  |  2.0 KB  |  79 lines  |  [TEXT/MPS ]

  1.             case obj
  2.             include 'traps.a'
  3.             
  4. MyControl    proc    export
  5.             import    DoConfirm:code
  6.             import    DoRemove:code
  7.             import    DoRegister:code
  8.             export    setTrap:code
  9.                                             ;    hi word ($fff6) is the appletalk driver refNum
  10.             cmpi.w    #$fff6, $18(a0)            ;    check 2 see if appletalk driver
  11.             bne.s    original                ;    nope. exit
  12.             
  13.             cmpi.w    #$00fa, $1a(a0)            ;    confirmName
  14.             blt.s    original                ;    if < confirm then blowout (!nbp call)
  15.             beq.s    processConfirm            ;    equal->confirm
  16.             
  17.             cmpi.w    #$00fb, $1a(a0)            ;    lookupName
  18.             beq.s    processConfirm
  19.             
  20.             cmpi.w    #$00fd, $1a(a0)            ;    registerName
  21.             beq.s    processRegister
  22.  
  23.             cmpi.w    #$00fc, $1a(a0)            ;    removeName
  24.             beq.s    processRemove
  25.             
  26. original    move.l    oldControl,-(a7)        ;    move original trap onto the stack
  27.             rts
  28.             
  29. doJump        move.l    a1, d0                    ;    move routine 2 go 2 into d0
  30.             move.l    $1e(a0), d1                ;    first byte of the objName
  31.             beq.s    end
  32.             move.l    d1, a1                    ;    move name 2 a1
  33.             lea        $9(a1), a1                ;    skip over addrblock and leave the 1st byte of text
  34.             bra.s    jumpOff
  35.             
  36. doJump2        move.l    a1, d0                    ;    move routine 2 go 2 into d0
  37.             move.l    $1e(a0), d1                ; 1st byte of the objname
  38.             beq.s    end
  39.             move.l    d1, a1
  40.  
  41. jumpOff     ;a1 = theText, d0 = routine
  42.             moveq    #$0, d1                    ;    clear out d1
  43.             move.b    (a1), d1                ;    length byte of objName
  44.             addq    #$1, d1                    ;    +1
  45.             add.l    a1, d1                    ;    add 'em together to get the typeName
  46.             move.l    a1, -(a7)                ;    push obj
  47.             move.l    d1, -(a7)                ;    push type
  48.             lea        end, a1
  49.             move.l    a1, -(a7)                ;    push return address
  50.             move.l    d0, -(a7)                ;    push routine
  51.             rts
  52.  
  53. end            addq    #$8, a7                    ;    throw out the stack
  54.             movem.l    (a7)+, d0-d2/a0-a1
  55.             bra.s    original
  56.  
  57. processRemove
  58.             movem.l    d0-d2/a0-a1, -(a7)
  59.             lea        DoRemove, a1
  60.             bra.s    doJump2
  61.  
  62. processConfirm
  63.             movem.l    d0-d2/a0-a1, -(a7)
  64.             lea        DoConfirm, a1
  65.             bra.s    doJump2
  66.  
  67. processRegister
  68.             movem.l    d0-d2/a0-a1, -(a7)
  69.             lea        DoRegister, a1
  70.             bra.s    doJump
  71.  
  72. setTrap        lea        oldControl, a1
  73.             move.l    a0, (a1)
  74.             rts
  75.             
  76. oldControl    dc.l    1                        ;    address of the original trap
  77.             endp
  78.  
  79.             end